package com.feign.retry;


import feign.Retryer;
import org.springframework.cloud.netflix.feign.FeignClientsConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * Feign重试
 * 注解方式，启动类中引入此类
 * 重写FeignClientsConfiguration中注入的bean（Retryer）.
 * @see FeignClientsConfiguration#feignRetryer()
 * */
@Configuration
public class FeignRetryer {

    @Bean
    public Retryer retryer(){
        return new Retryer.Default(100,
                TimeUnit.SECONDS.toMillis(1), 5);
    }

}
